package com.googlecode.flealancemarket.metamodel.beans;

import com.googlecode.flealancemarket.core.beans.BaseBean;
import com.googlecode.flealancemarket.metamodel.Freelancer;
import com.googlecode.flealancemarket.metamodel.Job;
import com.googlecode.flealancemarket.metamodel.JobMessage;
import java.sql.Date;
import java.util.Calendar;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;

@Entity
public class JobMessageBean extends BaseBean implements JobMessage {

    private Job job;
    private Freelancer author;
    private Date creationTime = new Date(Calendar.getInstance().getTimeInMillis());
    private int estimatedTime;
    private int amount;
    private String text;

    @ManyToOne(targetEntity=JobBean.class, fetch = FetchType.EAGER)
    public Job getJob() {
        return job;
    }

    public void setJob(Job job) {
        this.job = job;
    }

    @ManyToOne(targetEntity=FreelancerBean.class, fetch=FetchType.EAGER)
    public Freelancer getAuthor() {
        return author;
    }

    public void setAuthor(Freelancer author) {
        this.author = author;
    }

    public Date getCreationTime(){
        return creationTime;
    }

    public void setCreationTime(Date time) {
        this.creationTime = time;
    }

    public int getEstimatedTime() {
        return estimatedTime;
    }

    public void setEstimatedTime(int estimatedTime) {
        this.estimatedTime = estimatedTime;
    }

    public int getAmount() {
        return amount;
    }

    public void setAmount(int amount) {
        this.amount = amount;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

}